package com.hhit.zhgd.controller

import com.hhit.zhgd.domain.entity.ZhgdAwardManagement
import com.hhit.zhgd.domain.response.BaseResp
import com.hhit.zhgd.service.ZhgdAwardManagementService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile

@RestController
@RequestMapping("/tJjAwardManagement")
class ZhgdAwardManagementController {
    @Autowired
    private val zhgdAwardManagementService: ZhgdAwardManagementService? = null

    @PostMapping("findTJjAwardManagementList")
    fun findTJjAwardManagementList(@RequestBody zhgdAwardManagement: ZhgdAwardManagement?): BaseResp<Any?>? {
        try {
            return BaseResp.success(zhgdAwardManagementService?.selectAll(zhgdAwardManagement))
        } catch (e: Exception) {
            e.printStackTrace()
        }
        return BaseResp.fail("失败")
    }

    //    @ApiOperation(value = "查询计划列表")
    @PostMapping("findTJjRiskPlanList")
    fun findTJjRiskPlanList(@RequestBody zhgdAwardManagement: ZhgdAwardManagement?): BaseResp<Any?>? {
        try {
            return BaseResp.success(zhgdAwardManagementService?.findTJjRiskPlanList(zhgdAwardManagement))
        } catch (e: Exception) {
            e.printStackTrace()
        }
        return BaseResp.fail("失败")
    }


    //    @ApiOperation(value = "导入两个计划清单")
    @PostMapping("importExcel")
    fun importExcel(file: MultipartFile?): BaseResp<Any?>? {
        try {
            return zhgdAwardManagementService?.importExcel(file)
        } catch (e: Exception) {
            e.printStackTrace()
        }
        return BaseResp.fail("失败")
    }

    @GetMapping("deleteTJjRiskPlan")
    fun deleteTJjRiskPlan(@RequestParam("ids") ids: List<String?>?): BaseResp<Any?>? {
        try {
            return zhgdAwardManagementService?.deleteTJjRiskPlan(ids)
        } catch (e: Exception) {
            e.printStackTrace()
        }
        return BaseResp.fail("失败")
    }
}